package com.examples.datagrid.helper
{
	import com.examples.datagrid.model.ViewModel;
	import com.examples.datagrid.view.SampleDataGridView;
	
	import mx.collections.ArrayCollection;
	import mx.managers.PopUpManager;
	
	import org.seasar.akabana.yui.core.event.notify;
	import org.seasar.akabana.yui.core.event.send;
	import org.seasar.akabana.yui.framework.ns.helper;
	
	import spark.components.PopUpAnchor;
	import spark.components.PopUpPosition;

	public class SampleDataGridHelper
	{
		public var view:SampleDataGridView;
		public var model:ViewModel;
		
		public function setData(dataProvider:ArrayCollection):void {
			view.dtgrd.dataProvider = dataProvider;
		}
		
		public function showPopUp():void {
			// モーダルのポップアップの場合は、
			//  PopopUpManagerを使用してモーダル設定を行うしかないみたい。
			view.popUp.displayPopUp = true;
			send(view.popUpView, "send", view.dtgrd.selectedItem as ViewModel);
		}
		
		public function closePopUp():void {
			view.popUp.displayPopUp = false;
		}
		
		public function refection(model:ViewModel):void {
			view.dtgrd.selectedItem = model;
		}
	}
}